﻿/*
	Copyright (C) 2019 Zongming Liu <1849059316@qq.com>

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License along
	with this program; if not, write to the Free Software Foundation, Inc.,
	51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef IEvent_h__
#define IEvent_h__

#include "../utility/NonCopyable.h"
#include "../utility/MacroTool.h"

namespace SkyEngine2d
{
	
	/*!
	 \brief 事件接口
	 \details
	*/
	class SGE_API IEvent
		:public NonCopyable
	{
	public:
	
		enum class Type
		{
			//about input
			EventType_Mouse,				/*!< 鼠标事件.			*/
			EventType_Keyboard,				/*!< 键盘事件.			*/
			EventType_Character,			/*!< 字符输入事件.		*/
			//about widget 
			EventType_WidgetFocus,			/*!< 窗口的焦点事件.	*/
			EventType_WidgetMove,			/*!< 窗口移动事件.		*/
			EventType_WidgetActive,			/*!< 窗口活动事件.		*/
			EventTYpe_WidgetResize,			/*!< 窗口的大小改变.	*/
			EventType_EnterWidget,			/*!< 鼠标进入窗口的事件. */
			EventType_LeaveWIdget,			/*!< 鼠标离开窗口的事件. */
			//about normal event 
			EventType_NormalEvent,			/*!< 标准的事件. */
			//about user
			EventType_User					
		};
	
		IEvent(Type type)
			:m_type(type)
			,m_isAccept(false){}
	
		virtual ~IEvent() {}
	
		Type getType() { return m_type; }
	
	
		bool isAccept()const { return m_isAccept; }
		void accept() { m_isAccept = true; }
		void ignore() { m_isAccept = false; }
	private:
		bool m_isAccept;  //是否接受该事件
		Type				  m_type;
	};
}

#endif // IEvent_h__
